package com.sz.designpattern.behavior11.ob;

import java.util.ArrayList;
import java.util.List;

public class ConcreteObservable implements Observable {
    private List<Observer> lists = new ArrayList<>();
    @Override
    public void addObserver(Observer observer) {
        lists.add(observer);
    }

    @Override
    public void removeObserver(Observer observer) {
        lists.remove(observer);
    }

    @Override
    public void notifyObservers() {
        for (Observer observer : lists) {
            observer.update();
        }
    }
}
